package com.example.demo.easyexcel.db.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import com.alibaba.excel.enums.poi.FillPatternTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;

/**
 * @author zjq
 * @version 创建时间：2021-12-17 15:24:52
 */
@Data
@ContentRowHeight(10) // 设置 Cell 高度 为10
@HeadRowHeight(20)   //  设置表头 高度 为 20
@ColumnWidth(15)    //   列宽25
@ApiModel(value = "学生表")
@Entity
@Table(name = "base_student")
public class BaseStudent {

    @ExcelIgnore // 这个字段不会生成
    @Column(name = "id")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    // 头背景设置成红色 IndexedColors.RED.getIndex()  fillForegroundColor = 10 红色
    @HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 10)
    @ExcelProperty("学生姓名") // excel标题
    @ApiModelProperty(value = "学生姓名")
    @Column(name = "name")
    private String name;

    //	@ExcelProperty("性别")      也会生成，默认字段sex
    @ApiModelProperty(value = "性别")
    @Column(name = "sex")
    private String sex;

    @HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 10)
    @ColumnWidth(30)//宽度50
    @ExcelProperty("身份证")
    @ApiModelProperty(value = "身份证")
    @Column(name = "idcard")
    private String idcard;

    @ExcelProperty("学号")
    @ApiModelProperty(value = "学号")
    @Column(name = "xh")
    private String xh;

    @ExcelProperty("年龄")
    @ApiModelProperty(value = "年龄")
    @Column(name = "age")
    private String age;

    @Transient
    @HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 10)
    @ExcelProperty({"家长1", "家长姓名"})
    private String zjxm1;
    @Transient
    @HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 10)
    @ExcelProperty({"家长1", "家长电话"})
    private String zjdh1;
    @Transient
    @HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 10)
    @ExcelProperty({"家长1", "家长关系"})
    private String zjgx1;

    @Transient
    @ExcelProperty({"家长2", "家长姓名"})
    private String zjxm2;
    @Transient
    @ExcelProperty({"家长2", "家长电话"})
    private String zjdh2;
    @Transient
    @ExcelProperty({"家长2", "家长关系"})
    private String zjgx2;

}
